// Created by WXX on 2022/1/18 9:59
#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_map>

using namespace std;

class Solution {
public:
    unordered_map<char, int> mp = {{'a', 0}, {'e', 1}, {'i', 2}, {'o', 3}, {'u', 4}};

    int countVowelPermutation(int n) {

        const int N = 1e9 + 7;

        vector<vector<int>> f(n + 1, vector<int>(5));
        for (int i = 0; i < 5; i++) f[1][i] = 1;
        for (int i = 1; i < n; i++) {
            for (int j = 0; j < 5; j++) {
                if (j == 0) f[i + 1][mp['e']] = (f[i + 1][mp['e']] + f[i][j]) % N;
                else if (j == 1) {
                    f[i + 1][mp['a']] = (f[i + 1][mp['a']] + f[i][j]) % N;
                    f[i + 1][mp['i']] = (f[i + 1][mp['i']] + f[i][j]) % N;
                } else if (j == 2) {
                    for (int k = 0; k < 5; k++)
                        if (mp['i'] != k)
                            f[i + 1][k] = (f[i + 1][k] + f[i][j]) % N;
                } else if (j == 3) {
                    f[i + 1][mp['i']] = (f[i + 1][mp['i']] + f[i][j]) % N;
                    f[i + 1][mp['u']] = (f[i + 1][mp['u']] + f[i][j]) % N;
                } else {
                    f[i + 1][mp['a']] = (f[i + 1][mp['a']] + f[i][j]) % N;
                }
            }
        }

        int res = 0;
        for (int i = 0; i < 5; i++) res = (res + f[n][i]) % N;

        return res;
    }
};

int main() {

    cout << Solution().countVowelPermutation(1) << endl;  // 5
    cout << Solution().countVowelPermutation(2) << endl;  // 10
    cout << Solution().countVowelPermutation(5) << endl;  // 68

    return 0;
}
